package com.thothsun.notificationdemo.handlers;

import android.app.IntentService;
import android.content.Intent;

import androidx.annotation.Nullable;
import androidx.core.app.NotificationManagerCompat;

import com.thothsun.notificationdemo.MainActivity;

public class BigTextIntentService extends IntentService {

    public static final String ACTION_DISMISS = "com.thothsun.notificationdemo.handlers.action.DISMISS";

    public BigTextIntentService() {
        super("BigTextIntentService");
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        if (intent != null) {
            final String action = intent.getAction();
            if (ACTION_DISMISS.equals(action)) {
                NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(getApplicationContext());
                notificationManagerCompat.cancel(MainActivity.NOTIFICATION_ID);
            }
        }
    }
}
